﻿IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'medianamik_Property' AND COLUMN_NAME = 'IsGenerated')
ALTER TABLE dbo.medianamik_Property ADD
    IsGenerated bit NOT NULL CONSTRAINT DF_medianamik_Property_IsGenerated DEFAULT 1

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'medianamik_Property' AND COLUMN_NAME = 'IsDeleted')
ALTER TABLE dbo.medianamik_Property ADD
    IsDeleted BIT NOT NULL CONSTRAINT DF_medianamik_Property_IsDeleted DEFAULT 0

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'medianamik_NodeRevision' AND COLUMN_NAME = 'DynamicData')
ALTER TABLE dbo.medianamik_NodeRevision ADD
    DynamicData XML NOT NULL DEFAULT '<root><properties /></root>'

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'medianamik_Type' AND COLUMN_NAME = 'IsDeleted')
ALTER TABLE dbo.medianamik_Type ADD
    IsDeleted BIT NOT NULL CONSTRAINT DF_medianamik_Type_IsDeleted DEFAULT 0